package sf.model;

import java.sql.ResultSet;
import java.util.HashMap;
import java.util.LinkedHashMap;

import db.ebDB;
import db.ebDBDataSet;

public class DBManager {

	private static ebDB database;
	private static ebDBDataSet dataSet;

	private DBManager() {
	}

	public static void init(String tableName) {
		database = ebDB.getInstance();
		database.Connect();

		dataSet = new ebDBDataSet();
		dataSet.setTableName(tableName);
		dataSet.Prepare();
		dataSet.Open();
	}

	public static ebDBDataSet getDataSet() {
		return dataSet;
	}

	public static ebDB getDatabase() {
		return database;
	}

	public static ResultSet getResultSet() {
		return dataSet.getResultSet();
	}

	public static boolean insert(LinkedHashMap<String, Object> values) {
		return dataSet.insert(values);
	}

	public static boolean update(LinkedHashMap<String, Object> values) {
		return dataSet.update(values);
	}

	public static boolean delete(LinkedHashMap<String, Object> values) {
		return dataSet.delete(values);
	}
	
	public static boolean filter(HashMap<String, Object> values) {
		return dataSet.enableFilter(values);
	}
	
	public static boolean disableFilter() {
		return dataSet.disableFilter();
	}
	
	public static boolean refresh() {
		return dataSet.refreshDataSet();
	}
}
